Skip to content

chore: prepare repository for public release#13

Merged
marioarce merged 14 commits into
mainfrom
development
Jun 26, 2026
Merged

chore: prepare repository for public release#13
marioarce merged 14 commits into
mainfrom
development

Conversation

@marioarce

Copy link
Copy Markdown
Owner

This PR implements comprehensive code quality and documentation improvements to prepare the BitPerfectCore repository for public release.

Key changes:

  • Added structured logging system using os.Logger to replace debug print statements throughout the codebase
  • Extracted magic numbers and hardcoded values into centralized AudioConstants for better maintainability
  • Fixed code quality issues including misplaced imports, enum naming conflicts, and macOS 10.15 compatibility
  • Added GitHub Actions CI workflow for automated testing and validation
  • Rewrote test_suite.sh to remove references to personal music files and make it suitable for public use
  • Updated all documentation files to reflect public release status and remove internal development references
  • Moved internal development documentation to docs/internal/ directory and added to .gitignore
  • Replaced placeholder BitPerfectCore.swift with comprehensive module documentation
  • Improved error handling and removed silent error swallowing in critical audio paths
  • Enhanced thread safety in render callbacks

The changes address all identified issues from the repository review, ensuring the codebase meets public release standards with proper documentation, logging, and CI infrastructure.

marioarce and others added 14 commits June 25, 2026 17:58
Move AVFoundation import from bottom of file (line 275) to the top
with other imports, following Swift import conventions.
Add centralized AudioConstants enum with named constants for:
- Common and fallback sample rates
- S/PDIF fallback rate (48kHz)
- Buffer configuration (pool size, duration factor, safety margin)
- Device configuration settle delay
- Previous-track restart threshold
- Silence detection parameters
- Sample rate comparison tolerance
- Default compressed format bit depth

Replace all hard-coded values across:
- AudioDeviceManager
- SampleRateManager
- BitPerfectEngine
- GaplessEngine
- AudioRenderer
- AudioUnitRenderer
- PlaybackSettings
- BitPerfectCLI main
Add Log enum with categorized loggers using Apple's os.Logger:
- engine, device, renderer, decoder, sampleRate, buffer, playlist, profile, settings

Replace all print() statements across the library with appropriate Log calls:
- PlaybackSettings -> Log.settings
- DeviceProfileManager -> Log.profile
- DeviceCapabilityHelper -> Log.device
- DeviceCapabilityTester -> Log.device
- SampleRateManager -> Log.sampleRate
- BitPerfectEngine -> Log.engine
- AudioRenderer -> Log.renderer (removed dangerous RT callback logging)
- AudioUnitRenderer -> Log.renderer

Key improvements:
- Removed debug logging from real-time audio callbacks (AudioRenderer)
  to prevent audio glitches from blocking I/O on RT thread
- Removed debug counter variables (callbackCount, enqueueCount)
- All logs filterable by subsystem 'com.bitperfect.core' in Console.app
- Debug-level messages disabled in release builds by default
…ntation

Add comprehensive module-level documentation covering:
- Library purpose and architecture overview
- Key component listing with DocC symbol links
- Supported audio formats
- Usage example
- Logging subsystem info
- BitPerfectCore.version constant (0.5.0)
Move development-only files that are not suitable for public release:
- IMPROVEMENTS.md (production testing log)
- PRODUCTION_TESTING.md (internal testing guide)
- BIT_PERFECT_ACHIEVEMENT.md (development milestone)
- PROJECT_SETUP.md (initial setup notes, outdated)
- DEVICE_CAPABILITY_DETECTION.md (design spec, now implemented)

Valuable content preserved before moving:
- Bug fixes and improvements merged into CHANGELOG.md (Phase 5 section)
- TRUE bit-perfect data flow architecture added to DEVNOTES.md
- Public release preparation section added to CHANGELOG.md

Add docs/internal/ to .gitignore so these files remain local only.
- Update status from 'Private Development' to 'Active Development (v0.5.0)' across all docs
- Update FAQ from 'Phase 0' to current state (Phase 5 complete)
- Update ARCHITECTURE.md version from 0.1.0 to 0.5.0
- Add contact email (marioalberto.arce@proton.me) to CODE_OF_CONDUCT.md and SECURITY.md
- Update all 'Last Updated' dates to June 2026
- Update CHANGELOG.md footer status
- Update DEVNOTES.md maintainer and version info
Remove references to user-specific music files.
Restructure into 5 stages:
1. Release build verification
2. Unit tests (swift test)
3. CLI smoke tests (help, devices)
4. Error handling (empty playlist, invalid file)
5. Optional playback smoke test (pass audio file as argument)

Add pass/fail/skip counters and summary output.
Exit with non-zero status on any failure.
- Query actual device stream formats for supported bit depths instead
  of hardcoding [16, 24, 32] (AudioDeviceManager.getSupportedBitDepths)
- Add AudioConstants.fallbackBitDepths for when stream query fails
- Fix silent error swallowing in SampleRateManager.setDeviceSampleRate:
  now logs error and throws instead of silently returning
- Fix implicit self capture errors in os.Logger string interpolation
  (DeviceCapabilityTester, AudioUnitRenderer)
- Bump minimum deployment target from macOS 10.15 to 11.0
  (required by os.Logger)

All 21 tests pass.
Build and test on macOS 14 (macos-14 runner) with Xcode 15.4.
Runs on pushes to main/development and all PRs.
Steps: debug build, release build, test suite.
Replace os.Logger (macOS 11+) with OSLog + os_log (macOS 10.12+).
New LogCategory struct wraps OSLog and provides the same .debug(),
.info(), .warning(), .error() API — all call sites unchanged.

Reverts Package.swift minimum deployment target to .macOS(.v10_15).
- Rename BitPerfectCore enum to BPCInfo to prevent naming conflict with module name
- Add [BPC] prefix to all log output methods for easier identification in console
- Update debug, info, warning, and error logging to include consistent prefix
- Convert BitPerfectCoreTests.swift from Swift Testing (requires Swift 6.0)
  to XCTest for compatibility with Xcode 15.4 / Swift 5.10
- Fix unsafe pointer warnings in AudioDevice.swift: use
  withUnsafeMutablePointer for AudioValueTranslation and CFString properties
- Fix unsafe pointer warning in AudioDeviceManager.swift: use
  withUnsafeMutablePointer for CFString property query
- Fix ALACDecoder.swift: var trackNumber → let (never mutated)
- Fix AudioDeviceManager.swift: remove unnecessary try, unused variable,
  and var→let for immutable status

Build: zero warnings, 21/21 tests pass.
chore: prepare repository for public release
@marioarce marioarce self-assigned this Jun 26, 2026
@marioarce marioarce merged commit 5ed9b34 into main Jun 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant